package br.com.async.core.domain.enterprise;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.SequenceGenerator;

import br.com.async.core.domain.AbstractBookmarks;

@Entity(name = "tb_operatingday")
public class OperatingDay implements AbstractBookmarks {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@SequenceGenerator(allocationSize = 1, initialValue = 1, name = "operatingday_seq", sequenceName = "operatigday_seq")
	@GeneratedValue(generator = "operatingday_seq", strategy = GenerationType.AUTO)
	@JoinColumn(nullable = false)
	private Integer code;
	@Enumerated(EnumType.STRING)
	private Day day;

	public OperatingDay() {
	}

	public OperatingDay(Day day) {
		super();
		this.day = day;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public Day getDay() {
		return day;
	}

	public void setDay(Day day) {
		this.day = day;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		result = prime * result + ((day == null) ? 0 : day.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		OperatingDay other = (OperatingDay) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		if (day != other.day)
			return false;
		return true;
	}

}
